package com.keon.jianbao.enu;

import com.keon.jianbao.AppConfig;
import com.keon.jianbao.R;

/**
 * Created by keon on 2015/9/17.
 */
public enum WebType {
    ACTIVITYLIST(1, 0, AppConfig.WEBWIEWHOST + "module=Activity&api=activity_lists_show"),
    ACTIVITY_SELF_SHOW(2, R.string.my_activity, AppConfig.WEBWIEWHOST + "module=Activity&api=activity_self_show", true),
    EXPERT_INTRO(3, R.string.expert_detail, AppConfig.WEBWIEWHOST + "module=Appraisal&api=expert_intro&expert_id=", true),
    ACTIVITY_SHOW(4, R.string.activity_detail, AppConfig.WEBWIEWHOST + "module=Activity&api=activity_show&activity_id=", true),
    TERM(5, R.string.term, "file:///android_asset/term/index.html" , true);

    private int id;
    private int title;
    private String url;
    private boolean hasTitle;

    public boolean isHasTitle() {
        return hasTitle;
    }

    public void setHasTitle(boolean hasTitle) {
        this.hasTitle = hasTitle;
    }

    private WebType(int id, int title, String url) {
        this.id = id;
        this.title = title;
        this.url = url;
    }

    private WebType(int id, int title, String url, boolean hasTitle) {
        this.id = id;
        this.title = title;
        this.url = url;
        this.hasTitle = hasTitle;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getTitle() {
        return title;
    }

    public void setTitle(int title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public static WebType getWebType(int id) {
        for (WebType c : WebType.values()) {
            if (c.getId() == id) {
                return c;
            }
        }
        return null;
    }
}
